import {
    createSlice
} from '@reduxjs/toolkit';

const initial = {
    value: [{
        name: 'xaixoaio',
        age: 12
    }, ],
};

export const personSlice = createSlice({
    name: 'person',
    initialState: initial,
    reducers: {
        addPerson: (state, action) => {
            state.value.push(action.payload);
        }
    }
});

export const selectPerson = state => state.person.value;


export const {
    addPerson
} = personSlice.actions;

export default personSlice.reducer;